using Godot;
using System;

public partial class TurretManager : Node3D
{
    //  可实例化的场景
    [Export] public PackedScene turretScene;
    // 导出敌人的路径变量
    [Export] public Path3D enemyPath;

    public override void _Ready()
    {
    }

    public override void _Process(double delta)
    {
    }

    public void buildTurret(Vector3 turretPosition)
    {
        // 必须强转成Node3D才有GlobalPosition属性
        Node3D newTurret = (Node3D)turretScene.Instantiate();
        BarbarianBlaster.Turret.Turret turretCs = newTurret as BarbarianBlaster.Turret.Turret;
        AddChild(newTurret);
        // 设置全球坐标
        newTurret.GlobalPosition = turretPosition;

        if (turretCs != null) turretCs.EnemyPath = enemyPath;
    }
}